A value from the given list of choices. The type of the returned value is the same as the type of the choices.
Choose returns a value from the list of choices based on the value of index. For example, if index is 1, it returns choice1 and if index is 2 it returns choice2 and so forth.
See Switch (expr1, value1, expr2, value2, ..., exprN, valueN) function for an example of this.
See Advanced record selection formulas for an explanation of the techniques involved.
The following examples are applicable to both Basic and Crystal syntax:
Choose (3, "Poor", "Fair", "Good", "Excellent")
Choose (2, 10 To 20, 100 To 200, 60 To 70)
Returns the Number Range value 100 To 200.
If a company has fiscal year starting July 1 (the 3rd calendar quarter) and it wants to print the fiscal quarter of each order date:
Rem Basic syntax
formula = Choose (DatePart ("q", {Orders.Order Date}), _
"third fiscal quarter", "fourth fiscal quarter", _
" first fiscal quarter", "second fiscal quarter")
//Crystal syntax
Choose (DatePart ("q", {Orders.Order Date}),
"third fiscal quarter", "fourth fiscal quarter",
"first fiscal quarter", "second fiscal quarter")
If {Orders.Order Date} is February 18, 1996, then the DatePart function call returns 1 since this date is in the first calendar quarter. Thus, the first choice value, namely the String value "third fiscal quarter" is returned by the formula.
IIF (expression, truePart, falsePart) function
Switch (expr1, value1, expr2, value2, ..., exprN, valueN) function
Select statements (Basic syntax)
Select expressions (Crystal syntax)
| Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com |